package com.pzhu.user.domain.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import com.mybatisflex.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 用户状态列举
 *
 * @author 75073
 * @date 2024/07/05
 */
@Getter
@AllArgsConstructor
public enum UserStatusEnum {
    DISABLE(0, "禁用"),
    NORMAL(1, "正常");
    /** 编码 */
    @EnumValue
    @JsonValue
    private final Integer code;

    private final String message;

    public static UserStatusEnum of(Integer code) {
        for (UserStatusEnum e : UserStatusEnum.values()) {
            if (e.getCode().equals(code)) {
                return e;
            }
        }
        return null;
    }
}
